<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    button.active{
      background-color: red;
    }
    .content{
      width: 200px;
      height: 200px;
      background-color: rgb(112, 122, 82);
    }
  </style>
</head>

<body>
  <div id="app">
      <div class="titles">
        <button :class="{active: num===0}" @click="tab(0)">1</button>
        <button :class="{active: num===1}" @click="tab(1)">2</button>
        <button :class="{active: num===2}" @click="tab(2)">3</button>
      </div>
      <div class="wrap">
        <div class="content" v-show="num === 0">内容1</div>
        <div class="content" v-show="num === 1">内容2</div>
        <div class="content" v-show="num === 2">内容3</div>
      </div>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        num: 0
      },
      methods: {
        tab(n){
          this.num = n;
        }
      }
    })
  </script>
</body>

</html>